import Vue from "vue";
import VueRouter from "vue-router";
// 解决重复跳转同一个路由报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
// 1、注册
Vue.use(VueRouter);
// 2、定义路规则
const routes = [
    {
        path: "/",
        redirect: "/index"
    },
    {
        path: "/index",
        component: () => import("@/views/index.vue")//引入首页
    }
    ,
    {
        path: "/shopCate",
        component: () => import("@/views/shopCate.vue")//引入商铺分类页面
    },
    {
        path: "/shopDetail",
        component: () => import("@/views/shopDetail.vue")//引入商铺详情页面
    },
    {
        path: "/login",
        // @是src这个目录的别名
        component: () => import("@/views/login.vue") // 按需引入
    },
    {
        path: "/reset",
        // @是src这个目录的别名
        component: () => import("@/views/reset.vue") // 按需引入
    },
    {
        path: "/goods",
        // @是src这个目录的别名
        component: () => import("@/views/goods.vue") // 按需引入
    },
    {
        path: '/search',
        component: () => import("../views/search.vue")
    }, {
        path: '/evaluate',
        component: () => import("../views/evaluate.vue")
    },


    {
        path: "/my",
        component: () => import("@/views/my.vue")
    },
    {
        path: "/login",
        component: () => import("@/views/login.vue")
    },
    {
        path: "/mymoney",
        component: () => import("@/views/mymoney.vue")
    },
    {
        path: "/youhui",
        component: () => import("@/views/youhui.vue")
    },
    {
        path: "/jifen",
        component: () => import("@/views/jifen.vue")
    },
    {
        path: "/dingdan",
        component: () => import("@/views/dingdan.vue")
    },
    {
        path: "/shopping",
        component: () => import("@/views/shopping.vue")
    },
    {
        path: "/huiyuan",
        component: () => import("@/views/huiyuan.vue")
    },
    {
        path: "/fuwu",
        component: () => import("@/views/fuwu.vue")
    },
    {
        path: "/download",
        component: () => import("@/views/download.vue")
    },
    {
        path: '/city',
        component: () => import('../views/city.vue')
    },
    {
        path: '/hom',
        component: () => import('../views/hom.vue')
    },
    {
        path: '/mymoneytwo',
        component: () => import('../views/mymoneytwo.vue')
    },
    {
        path: '/jifentwo',
        component: () => import('../views/jifentwo.vue')
    }

]
// 3、实例化路由对象
const router = new VueRouter({
    routes
})

// 4、导出路由对象
export default router